package br.jus.tjpe.negocio;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import br.jus.tjpe.dao.VaraDao;
import br.jus.tjpe.dominio.Vara;

@Stateless
public class VaraServicoImpl implements VaraServico {

	@EJB
	private VaraDao varaDao; 
	
	public VaraServicoImpl() {
	}

	/**
	 * @see br.jus.tjpe.negocio.VaraServico#consultarVaras()
	 */
	public List<Vara> consultarVaras(){
		return this.varaDao.buscarTodos();
	}
	
	/**
	 * @see br.jus.tjpe.negocio.VaraServico#salvar(br.jus.tjpe.dominio.Vara)
	 */
	public void salvar(Vara vara) {
		if (vara.getId() == null) {
			this.varaDao.inserir(vara);
		} else {
			this.varaDao.editar(vara);
		}
	}

	/**
	 * @see br.jus.tjpe.negocio.VaraServico#remover(br.jus.tjpe.dominio.Vara)
	 */
	public void remover(Vara vara) {
		this.varaDao.remover(vara);
	}

}
